<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .parent {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      text-align: center;
      background: red;
      font-size: 0;
    }
    .parent::after {
      content: '';
      display: inline-block;
      height: 100%;
      vertical-align: middle;
    }
    .child {
      display: inline-block;
      width: 100px;
      height: 100px;
      background: green;
    }
  </style>
</head>
<body>
  <div class="parent">
    <div class="child"></div>
  </div>
</body>
</html>